#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int n = 0;
    int k = 0;
    int s = 0;
    scanf("%d %d %d", &n, &k, &s);
    int i = 0;
    int x = 0;
    int y = 0;
    int count = 0;
    int arr[291] = { 0 };
    for (i = 0; i < n; i++)
    {
        scanf("%d %d", &x, &y);
        if (x >= 175)
        {
            if (y >= s)
            {
                count++;
            }
            else if (arr[x] < k)
            {
                arr[x]++;
                count++;
            }
        }
    }
    printf("%d", count);
}